package com.xxxx.web.dto;

import com.xxxx.web.entity.*;
import com.xxxx.web.enums.*;
import com.xxxx.web.tools.dto.BaseDto;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;

/**
 * 仓库用户表类
 */
@Data
public class WarehouseRelativeUserDto extends BaseDto {


    /**
     * 仓库
     */
    @JsonProperty("WarehouseId")
    private Integer WarehouseId;


    /**
     * 用户
     */
    @JsonProperty("UserId")
    private Integer UserId;

    @JsonProperty("UserDto")
    private AppUserDto UserDto;

    @JsonProperty("WarehouseDto")
    private WarehouseDto WarehouseDto;

    /**
     * 把仓库用户表传输模型转换成仓库用户表实体
     */
    public WarehouseRelativeUser MapToEntity() throws InvocationTargetException, IllegalAccessException {
        WarehouseRelativeUser WarehouseRelativeUser = new WarehouseRelativeUser();

        BeanUtils.copyProperties(WarehouseRelativeUser, this);

        return WarehouseRelativeUser;
    }

}
